<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>元宝票管</title>
    <link href="{{ url_for('static', filename='css/bootstrap.min.css') }}" rel="stylesheet">
</head>
<body>
    <nav class="navbar navbar-expand-lg navbar-dark bg-primary">
        <div class="container">
            <a class="navbar-brand" href="{{ url_for('dashboard') }}">元宝差旅票务管理系统</a>
            <div class="navbar-nav">
                {% if 'user_id' in session %}
                <span class="navbar-text me-3">欢迎, {{ session['username'] }}</span>
                <a class="nav-link" href="{{ url_for('logout') }}">退出</a>
                {% else %}
                <a class="nav-link" href="{{ url_for('register') }}">注册</a>
                <a class="nav-link" href="{{ url_for('login') }}">登录</a>
                
                {% endif %}
            </div>
        </div>
    </nav>

    <div class="container mt-4">
        {% with messages = get_flashed_messages(with_categories=true) %}
            {% if messages %}
                {% for category, message in messages %}
                <div class="alert alert-{{ category }} alert-dismissible fade show">
                    {{ message }}
                    <button type="button" class="btn-close" data-bs-dismiss="alert"></button>
                </div>
                {% endfor %}
            {% endif %}
        {% endwith %}
        
        {% block content %}{% endblock %}
    </div>

<script src="{{ url_for('static', filename='js/bootstrap.bundle.min.js') }}"></script>
    {% block scripts %}{% endblock %}
</body>
</html>